from random import random, randint

x = randint(1000, 9999)
s = str(x)
print(s)
for i in range(3, -1, -1):
    print(s[i], end='')